package ding

import (
	"github.com/gin-gonic/gin"
	"wonlicsys/service/api/dingService"
	"wonlicsys/utils/common"
)

type ReqStruct struct {
	Encrypt string `valid:"Required;" chn:"Encrypt" eng:"Encrypt" json:"encrypt"`
}

func CallBack(c *gin.Context) {
	reqParam := ReqStruct{}
	if err := common.GetParamStruct(c, &reqParam); err != nil {
		common.JsonResult(c, 400, err.Error(), "fail")
		return
	}

	var dingServices dingService.DingCallBackService
	if err := dingServices.CallBackService(c.Request.URL.Query(), reqParam.Encrypt); err != nil {
		common.JsonResult(c, 400, err.Error(), "fail")
		return
	}
	c.JSON(200, dingServices.Response)
}
